<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改分类</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.4.4.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="${Plugins}/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/common/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>
<script src="${BasePath}/res/js/common/jquery.validate.method.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/product/update_commodity_cat.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/product/commodityCat.js" type="text/javascript"></script>

<style type="text/css">
    body{ font-size:12px;}
    .l-table-edit {}
    .l-table-edit-td{vertical-align: top;padding: 5px;}
    .l-button-submit,.l-button-test{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
    .l-verify-tip{ left:230px; top:120px;}
    .p-tab .s-lab{font-size:12px;font-family:"微软雅黑",​"宋体",​Arial,​sans-serif;}
	input.l-textarea{width:170px;height:20px;font-size:12px;}
	 .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
	ul {list-style:none; border: 1px solid #DDDDDD; width:400px; float:left;}
	.li_ls{
		float:left; 
		width:30%; 
		margin:5px; 
		word-break:keep-all;/* 不换行 */
		white-space:nowrap;/* 不换行 */
		overflow:hidden;
		text-overflow:ellipsis;
	}
	h4{border-bottom: 1px solid #DDDDDD;}
	select{margin-right: 10px;}
</style>

<script type="text/javascript">
var basePath="${BasePath}";
var catPno = "${catVo.catPno}";
var catNo = "${catVo.catNo}";
</script>
</head>
<body style="padding:10px">
<div class="navbar">
		<span>您当前的位置：</span>
		商品管理 &gt;分类列表&gt;修改分类
</div>
<form name="form1" method="post" action="updateCommodityCat.do" id="form1">
<input type="hidden" id="catNo" name="catNo" value="${catVo.catNo}">
<input type="hidden" id="catPno" name="catPno" value="${catVo.catPno}">
<br>
<table cellpadding="0" cellspacing="0" class="l-table-edit p-tab" >
    <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>上级分类:</td>
        <td align="left" class="l-table-edit-td s-lab">
        	<div id="catDiv"></div>
        </td>
        <td align="left"></td>
    </tr>
    <tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>分类名称:</td>
        <td align="left" class="l-table-edit-td s-lab"><input maxlength="20" value="${catVo.catName }" name="catName" type="text" class="l-textarea" id="catName" validate="{required:true,minlength:1,maxlength:50,catName_exit:true}" /></td>
        <td align="left"></td>
    </tr>
	<tr>
        <td align="right" class="l-table-edit-td s-lab"><font color="red">*</font>编号:</td>
        <td align="left" class="l-table-edit-td s-lab"><input value="${catVo.no }" id="no" name="no" type="text"  readonly="readonly" class="l-textarea" id="no"  maxlength="6" validate="{required:true,minlength:6,maxlength:6,}"/></td>
        <td align="left"></td>
    </tr>
	 <tr>
        <td align="right" class="l-table-edit-td s-lab">分类描述：</td>
        <td align="left" class="l-table-edit-td s-lab"><textarea onkeyup="this.value=this.value.substring(0,200);" rows="5" cols="20" name="description" validate="{required:false,maxlength:200}" >${catVo.description }</textarea></td>
        <td align="left"></td>
    </tr>
</table>
<input type="submit" value="保存" id="Button1" class="l-button l-button-submit" /> 
<input type="button" value="取消" name="tests"  id="tests" class="l-button l-button-test" />
</form>
<script type="text/javascript">
$(function(){
    var oldCatName = "${catVo.catName}";
    jQuery.validator.addMethod("catName_exit",function(value,element){
	var catName=$("#catName").val();
	var rst = false;
	if(oldCatName == catName){
		rst = true;
	}else{
		 $.ajax({
				type:"POST",
				url:basePath + "/product/cat/checkCatName.do",
				data:{"catName":catName},
				async : false,
				success:function(data){
					if(data=="fail"){
						rst = false;
					}else{
						rst = true;
					}
				}
			});
	   }
	  return this.optional(element) || rst;

   },"该分类名称已存在，请重输入");
});



//取消
$("#tests").click(function() {
	close_liger_tab();
});
</script>

</body>
</html>
